﻿#region Copyright (C) Sector7 Software Studio. All rights reserved
/*******************************************************************************************
 * Creation
 *      Author:         Wolf Lai
 *      Date:           2013/6/6 星期四 23:37:46
 *      Version:        
 * Modification 
 *      Author: 
 *      Date: 
 *      Description: 
 *      Version:
 *******************************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Sector7.Medical.EntityType;
using Sector7.Framework.DB;
using Sector7.Medical.Consts;
using Sector7.Medical.DAO.Utility;

namespace Sector7.Medical.DAO.Standard
{
    /// <summary>
    /// <!-- The description about this class. -->
    /// </summary>
    public class DispenseBillDAO : DAOBase<M7_DispenseBill>, IDispenseBillDAO
    {
        #region Public functions

        /// <summary>
        /// 添加科室
        /// </summary>
        /// <param name="department">科室信息</param>
        /// <returns></returns>
        public override object Create(M7_DispenseBill dispenseBill)
        {
            string sql = @"
                INSERT INTO M7_DispenseBill
                        (BillId
                        ,EmrId
                        ,DeptId
                        ,OperatorId
                        ,AgentName
                        ,CreateTime
                        ,Status)
                    VALUES
                        (@BillId
                        ,@EmrId
                        ,@DeptId
                        ,@OperatorId
                        ,@AgentName
                        ,@CreateTime
                        ,@Status)";

            using (DBHelper helper = new DBHelper())
            {
                return helper.ExecuteNonQuery(sql,
                    DBUtil.CreateSqlParameter(dispenseBill.BillId, "BillId"),
                    DBUtil.CreateSqlParameter(dispenseBill.EmrId, "EmrId"),
                    DBUtil.CreateSqlParameter(dispenseBill.DeptId, "DeptId"),
                    DBUtil.CreateSqlParameter(dispenseBill.OperatorId, "OperatorId"),
                    DBUtil.CreateSqlParameter(dispenseBill.AgentName, "AgentName"),
                    DBUtil.CreateSqlParameter(dispenseBill.CreateTime, "CreateTime"),
                    DBUtil.CreateSqlParameter(dispenseBill.Status, "Status"));
            }
        }
        #endregion

        #region Structure
        public DispenseBillDAO()
        {
            m_tableName = C_M7_TableName.DISPENSE_BILL;
            m_primaryKeyName = C_PrimaryKeyName.DISPENSE_BILL_ID;
        }
        #endregion
    }
}
